<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>企业注册-河北省建筑施工质量全过程监管系统</title>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta http-equiv="Expires" CONTENT="0">
    <meta http-equiv="Cache-Control" content="no-siteapp,no-transform,no-store, no-cache, must-revalidate">
    <meta http-equiv="Pragma" content="no-cache">
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon"/>
    <link rel="stylesheet" href="/static/css/font.css">
    <link rel="stylesheet" href="/static/css/weadmin.css">
    <script type="text/javascript" src="/lib/layui/layui.js" charset="utf-8"></script>
    <link rel="stylesheet" href="/static/css/buildUnit/common.css">
    <style>
        body {
            height: auto;
        }

        .content {
            width: 1200px;
            margin: 0 auto;
            align-content: center;
        }

        .layui-disabled {
            color: #aaa !important;
        }

        .personInfo {
            display: none;
        }

        .layui-form-checkbox[lay-skin=primary] span {
            color: #3366CC;
        }

        .footer {
            position: relative;
            width: 100%;
            bottom: 0;
            text-align: center;
            background-color: #fff;
            padding: 10px 0;
        }

        .jsdwTr {
            display: none;
        }

        .personTr {
            display: none;
        }

        .top {
            height: 100px;
            position: relative;
            background: #F0F0F0 url(/static/images/1.png) no-repeat center center;
            background-size: 1400px auto;
        }

        .top_center {
            position: absolute;
            z-index: 4;
            top: 26px;
            width: 100%;
        }

        .rf {
            float: right;
            overflow: hidden;
        }

        .w1000 {
            width: 1000px;
            margin: 0 auto;
            height: auto;
            overflow: auto;
        }

        .yhzx {
            text-align: right;
            font-size: 17px;
            color: #1577dc;
        }
    </style>
</head>
<body>
<div class="top">
    <div class="top_left"></div>
    <div class="top_center">
        <div class="w1000" style="position:relative;">
            <div class="rf">
                <div class="yhzx">
                    <a href="/pages/register/unit/signUp.html">企业注册</a>&nbsp;|&nbsp;
                    <a href="/pages/register/user/userSignUp.html">个人注册</a>&nbsp;|&nbsp;
                    <a href="/">已有账号？去登陆</a>
                </div>
            </div>
            <div class="cf"></div>
        </div>
    </div>
    <div class="top_right"></div>
</div>
<div class="content">
    <div class="layui-row registerBox">
        <div class="layui-col-xs4 layui-bg-blue">
            1、填写注册信息
        </div>
        <div class="layui-col-xs4 layui-bg-gray borderCustom">
            2、验证邮箱
        </div>
        <div class="layui-col-xs4 layui-bg-gray">
            3、系统审核
        </div>
    </div>
    <!--机构信息-->
    <form class="layui-form layui-form-pane" id="form" lay-filter="form">
        <table class="layui-table v-table">
            <tbody>
            <tr>
                <td class="th8 required">单位类型</td>
                <td colspan="3">
                    <select name="orgType" id="orgType" class="formData" lay-filter="orgType"
                            lay-verify="required">
                        <option value="">直接选择或搜索</option>
                    </select>
                    <input type="hidden" name="orgNo" id="orgNo" class="formData" value="">
                </td>
            </tr>
            <tr class="jsdwTr">
                <td class="th8 required">建设单位类型</td>
                <td colspan="3">
                    <input type="radio" name="orgPerson" id="orgPerson" class="formData" value="1" lay-filter="typeItem"
                           title="企业（有营业执照）" checked>
                    <input type="radio" name="orgPerson" class="formData" value="2" lay-filter="typeItem" title="个人">
                </td>
            </tr>
            <tr class="jgTr">
                <td class="th8 required">单位名称</td>
                <td colspan="3">
                        <input type="text" name="orgName" id="orgName" required lay-verify="isEmpty" placeholder="请输入"
                           autocomplete="off"
                           class="layui-input formData">
                </td>
            </tr>
            <tr class="jgTr">
                <td class="th8 required" style="color:#666;">
                    统一社会信用代码
                </td>
                <td class="orgCodeBox" colspan="3">
                    <input type="text" name="creditCode" id="creditCode" required lay-verify="isEmpty" placeholder="请输入"
                           autocomplete="off"
                           class="layui-input orgCode formData">
                    <div class="tdBz" style="color:red;">
                        注：该号码为企业唯一标识，请如实填写
                    </div>
                </td>
            </tr>
            <tr class="jgTr">
                <td class="th8 required">工商登记类型</td>
                <td colspan="3">
                    <select name="orgRegistryType" class="orgRegistryType formData" lay-filter="orgRegistryType"
                            lay-verify="isEmpty">
                        <option value="">请选择</option>
                    </select>
                </td>
            </tr>
            <tr class="jgTr">
                <td class="th8 required">经济类型</td>
                <td colspan="3">
                    <select name="ectType" class="ectType formData" lay-filter="ectType"
                            lay-verify="isEmpty">
                        <option value="">请选择</option>
                    </select>
                </td>
            </tr>
            <tr class="jgTr">
                <td class="th8 required">资质等级</td>
                <td colspan="3">
                    <input type="text" name="zzdj" id="zzdj" required lay-verify="isEmpty" placeholder="请输入"
                       autocomplete="off"
                       class="layui-input formData">
                </td>
            </tr>
            <tr class="jgTr">
                <td class="th8 required">资格证书名称</td>
                <td colspan="3">
                    <input type="text" name="zgzsmc" id="zgzsmc" required lay-verify="isEmpty" placeholder="请输入"
                           autocomplete="off"
                           class="layui-input formData">
                </td>
            </tr>
            <tr class="jgTr">
                <td class="th8 required">资格证书编号</td>
                <td colspan="3">
                    <input type="text" name="zgzsbh" id="zgzsbh" required lay-verify="isEmpty" placeholder="请输入"
                           autocomplete="off"
                           class="layui-input formData">
                </td>
            </tr>
            <tr>
                <td class="th8 required">企业注册地址</td>
                <td colspan="3">
                    <div class="layui-input-inline">
                        <select name="provinceNo"  lay-filter="provinceNo" lay-verify="isEmpty"
                                class="formData">
                            <option value="">请选择省</option>
                        </select>
                    </div>
                    <div class="layui-input-inline">
                        <select name="cityNo" lay-filter="cityNo" lay-verify="isEmpty" class="formData">
                            <option value="">请选择市</option>
                        </select>
                    </div>
                    <div class="layui-input-inline">
                        <select name="countyNo" lay-filter="countyNo" lay-verify="isEmpty"
                                class="formData">
                            <option value="">请选择县/区</option>
                        </select>
                    </div>
                    <div class="layui-input-inline">
                        <input name="address" id="address" lay-verify="isEmpty" type="text" class="layui-input formData">
                    </div>
                </td>
            </tr>
            <tr class="jgTr">
                <td class="th8 required">企业法人</td>
                <td colspan="3">
                    <input type="text" name="comartiperson" id="comartiperson" lay-verify="isEmpty" placeholder="请输入"
                           autocomplete="off"
                           class="layui-input formData">
                </td>
            </tr>
            <tr class="jgTr">
                <td class="th8 required">法人联系方式</td>
                <td colspan="3">
                    <input type="text" name="comartiphone" id="comartiphone" lay-verify="isEmpty|linkPhone" placeholder="请输入"
                           autocomplete="off"
                           class="layui-input vPhone formData">
                </td>
            </tr>
            <!--<tr class="">
                <td class="th8 required">企业联系邮箱</td>
                <td colspan="3">
                    <input type="text" name="orgLinkMailbox" lay-verify="isEmpty|email" placeholder="请输入"
                           autocomplete="off"
                           class="layui-input vEmail formData orgLinkMailbox">
                    <div class="tdBz" style="color:red;">
                        注：该该邮箱将作为密保邮箱，请谨慎填写
                    </div>
                </td>
            </tr>-->
            <tr class="personTr">
                <td class="th8 required">联系人姓名</td>
                <td colspan="3">
                    <input type="text" name="comconnperson" id="comconnperson" lay-verify="isEmpty" placeholder="请输入"
                           autocomplete="off"
                           class="layui-input formData">
                </td>
            </tr>
            <tr class="personTr">
                <td class="th8 required">联系人身份证号</td>
                <td colspan="3">
                    <input type="text" name="comartiCertCode" id="comartiCertCode" lay-verify="isEmpty" placeholder="请输入"
                           autocomplete="off"
                           class="layui-input formData">
                    <div class="tdBz" style="color:red;">
                        注：改号码为唯一标识且不可更改，请谨慎填写
                    </div>
                </td>
            </tr>
            <tr class="personTr">
                <td class="th8 required">联系人手机</td>
                <td colspan="3">
                    <input type="text" name="orgLinkPhone" id="orgLinkPhone" lay-verify="isEmpty|linkPhone" placeholder="请输入"
                           autocomplete="off"
                           class="layui-input vPhone formData">
                </td>
            </tr>
            <tr class="">
                <td class="th8 required jrperTr">企业邮箱</td>
                <td colspan="3">
                    <input type="text" name="orgLinkMailbox" lay-verify="isEmpty|email" placeholder="请输入"
                           autocomplete="off"
                           class="layui-input vEmail formData orgLinkMailbox">
                    <div class="tdBz" style="color:red;">
                        注：该邮箱将作为密保邮箱，请谨慎填写
                    </div>
                </td>
            </tr>
            <tr>
                <td class="th8 required">登录名称</td>
                <td colspan="3">
                    <input type="text" name="userName" id="userName" lay-verify="required|upass" placeholder=""
                           autocomplete="off"
                           class="layui-input loginName formData">
                    <div class="tdBz" style="color:red;">
                        注：数字、字母或下划线组成，长度6-50位
                    </div>
                </td>
            </tr>
            <tr>
                <td class="th8 required">登录密码</td>
                <td>
                    <input type="password" name="password" lay-verify="required|upass" placeholder=""
                           autocomplete="off"
                           class="layui-input password formData">
                    <div class="tdBz" style="color:red;">
                        注：数字、大小写字母或特殊符号组成，长度至少8位
                    </div>
                </td>
                <td class="th8 required">确认密码</td>
                <td>
                    <input type="password" name="" lay-verify="required|upass" placeholder=""
                           autocomplete="off"
                           class="layui-input rePassword">
                </td>
            </tr>
            <tr>
                <td class="th8 required">资料上传</td>
                <td colspan="3">
                    <div class="fjBzBox">
                        <p><span>1</span>、单位有效证件（统一社会信用代码证、营业执照副本或事业单位法人证书等）→复印→盖章→扫描或拍照；</p>
                        <p><span>2</span>、联系人身份证明（身份证等）→证件正反面复印到一张A4纸→盖章（公章）→扫描或拍照；</p>
                        <p>注：照片完整、文字清晰可辨，照片格式为"jpg格式"或"png格式"，扫描分辨率100DPI即可，单张图片不要超过2M。</p>
                    </div>
                    <div>
                        <!--<iframe src="" frameborder="0" class="attachmentList" name="attachmentList" style="height:120px;"></iframe>-->
                    </div>
                </td>
            </tr>
            <tr>
                <td colspan="4" style="text-align: center;">
                    <input class="isAgree" type="checkbox" name="" title="我已经认真如实填写上述资料，并且对所填写的资料负责。" lay-skin="primary"
                           lay-filter="isAgree">
                </td>
            </tr>
            <tr>
                <td colspan="4" style="text-align: center;">
                    <button class="demo1 layui-btn layui-btn-disabled layui-btn-normal" lay-filter="demo1" lay-submit
                            disabled="true">
                        提交注册
                    </button>
                    <button onclick="cancel()" type="button" class="layui-btn">取消注册</button>
                </td>
            </tr>
            </tbody>
        </table>

    </form>
</div>

<div class="footer" style="background: #f3f3f3;padding: 30px 0px;box-sizing: border-box;">
    <div class="footer_con" style="color: #333;width: 345px;margin: 0px auto;box-sizing: border-box;padding: 0;">

        <!--
              <img class="lf" src="/statics/images/zd.png"  style="border: none;vertical-align: middle;float: left;margin: 30px 20px 10px 0px;
      }"/>
        -->
        <div class="footer_con_text" style="width: 500px;text-align: left;">

             <p style="margin: 0;padding: 0;word-wrap: break-word;box-sizing: border-box;">
                <a>设为首页</a>|
                <a>联系我们</a>|
                <a>本站声明</a>
            </p>

            <p>技术支持：河北霄岭工程设计咨询有限公司</p>

        </div>
    </div>
</div>

<script src="/static/js/main.js"></script>
<script type="text/javascript">

    layui.use(['jquery', 'form', 'configure', 'configureCom', 'sessionFun', 'bluebird','selectFun'], function () {
        var form = layui.form;
        var configure = layui.configure;
        var configureCom = layui.configureCom;
        var sessionFun = layui.sessionFun;
        var selectFun = layui.selectFun;
        window.$ = layui.jquery;
        var typeItem = '1';//注册类型 1 企业 1 个人
        var defaults = {};
        var dataList ={};
        var orgNo = configureCom.GetQueryString('orgNo');//截取单位ID
        var registerData = sessionFun.get(configure.SESSION_REGISTER_DATA);
        if(orgNo){//通过企业注册审核进入
            sessionFun.remove(configure.SESSION_REGISTER_DATA);
            configureCom.postDataAjax(configure.COMPANY_GET_ORG_INFOMATION_HTTP,{orgNo:orgNo}).then(function (res) {
                dataList = res.org;
                if(dataList.orgType == 1){
                    $('.jsdwTr').show();
                }
                configureCom.selectDataFun(configure.ORG_REGIST_TYPE, dataList.orgRegistryType, '.orgRegistryType');    //工商登记类型
                configureCom.selectDataFun(configure.ECT_TYPE, dataList.ectType, '.ectType');                           //经济类型
                configureCom.selectDataFun(configure.COMPANY_TYPE_CODE,dataList.orgType , '#orgType');                  //单位类型
                defaults = {
                    s1: 'provinceNo',
                    s2: 'cityNo',
                    s3: 'countyNo',
                    v1: 130000,
                    v2: dataList.cityNo,
                    v3: dataList.countyNo
                };
                selectFun.treeSelect(defaults);
                form.render();
                form.val('form',dataList)
            });
        }else{//通过重新填写进入
            if(registerData){
                if(registerData.orgType == 1){
                    // $('.jsdwTr').show();
                }
                configureCom.selectDataFun(configure.ORG_REGIST_TYPE, registerData.orgRegistryType, '.orgRegistryType'); //工商登记类型
                configureCom.selectDataFun(configure.ECT_TYPE, dataList.ectType, '.ectType'); //经济类型
                configureCom.selectDataFun(configure.COMPANY_TYPE_CODE,registerData.orgType , '#orgType'); //单位类型
                defaults = {
                    s1: 'provinceNo',
                    s2: 'cityNo',
                    s3: 'countyNo',
                    v1: 130000,
                    v2: registerData.cityNo,
                    v3: registerData.countyNo
                };
                selectFun.treeSelect(defaults);
                form.render();
                form.val('form',registerData)
            }else{//初始化进入
                sessionFun.remove(configure.SESSION_REGISTER_DATA);
                configureCom.selectDataFun(configure.ORG_REGIST_TYPE, '', '.orgRegistryType');//工商登记类型
                configureCom.selectDataFun(configure.ECT_TYPE, '', '.ectType'); //经济类型
                configureCom.selectDataFun(configure.COMPANY_TYPE_CODE, '', '#orgType');//单位类型
                defaults = {
                    s1: 'provinceNo',
                    s2: 'cityNo',
                    s3: 'countyNo',
                    v1: 130000,
                    v2: null,
                    v3: null
                };
                selectFun.treeSelect(defaults);
                form.render();
            }

        }
        // //切换单位类型
        // form.on('select(orgType)', function (data) {
        //     if (data.value == 1) {//选择建设单位
        //         $('.jsdwTr').show();
        //         if (typeItem == '2') {//个人
        //             $('.personTr').show();
        //             $('.jgTr').hide();
        //             $('.jrperTr').html('联系人邮箱')
        //         } else {
        //             $('.personTr').hide();
        //             $('.jgTr').show();
        //             $('.jrperTr').html('企业邮箱')
        //         }
        //     } else {
        //         $('.jsdwTr').hide();
        //     }
        //     if(data.value != 1){
        //         $('.personTr').hide();//建设单位类型
        //         $('.jgTr').show();
        //         $('.jrperTr').html('企业邮箱')
        //     }
        //     form.val('form',data)
        // });


        form.verify({
            isEmpty: function (value, item) {
                var parentTr = $(item).parents('tr');
                if (!parentTr.is(':hidden')) {
                    if (!($.trim(value))) {
                        return '必填项不能为空';
                    }
                }
            }
        });
        //选择不同的注册类型
        form.on('radio(typeItem)', function (data) {
            typeItem = data.value;
            var orgType = $('#orgType').val();//获取单位类型
            // 重置列表
            $('.layui-form')[0].reset();
            form.val("form", {orgType: orgType, orgPerson: typeItem});
            form.render();
            if (typeItem == '2') {//个人
                $('.personTr').show();
                $('.jgTr').hide();
                $('.jrperTr').html('联系人邮箱')
            } else {
                $('.personTr').hide();
                $('.jgTr').show();
                $('.jrperTr').html('企业邮箱')
            }
        });


        /*window.fjLoaded = function () {//附件列表渲染完毕重设附件列表序号
            if (window.hideTrNum == 1) {
                window.frames["attachmentList"].window.$('#attaList tr:nth-child(2) td').first().html(1);
            }
        };*/

        //是否同意提示信息
        form.on('checkbox(isAgree)', function (data) {
            var isAgree = data.elem.checked;//是否被选中，true或者false
            if (isAgree) {
                $('.demo1').attr('disabled', false).removeClass('layui-btn-disabled');
                form.render();
            } else {
                $('.demo1').attr('disabled', true).addClass('layui-btn-disabled');
                form.render();
            }
        });
        //保存机构信息
        form.on('submit(demo1)', function (data) {
            var formData = {};
            $('.formData').each(function (index, item) {
                if (!($(item).closest('tr').hasClass('hide'))) {
                    var key = '';
                    if ($(item).attr('type') == 'checkbox') {
                        key = $(item).attr('name');
                        var value = '';
                        $('[name="' + key + '"]:checked').each(function (index, item) {
                            if (!index) {
                                value = $(item).val();
                            } else {
                                value += ',' + $(item).val();
                            }
                        });
                        formData[key] = value;
                    } else if ($(item).attr('type') == 'radio') {
                        key = $(item).attr('name');
                        var value = '';
                        $('[name="' + key + '"]:checked').each(function (index, item) {
                            value = $(item).val();
                        });
                        formData[key] = value;
                    } else {
                        key = $(item).attr('name');
                        formData[key] = $(item).val();
                    }
                }
            });
            // 如果是个人 验证身份证号
            if (data.typeItem == '2030') {
                var reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
                if (!reg.test(data.code)) {
                    var msg = '请输入正确的身份证号';
                    top.layer.msg(msg);
                    return false;
                }
            }

            if ($('.rePassword').val() != $('.password').val()) {
                var msg = '两次输入的密码不一致';
                top.layer.msg(msg);
                return false;
            }
            data.orgType = $("#orgType").val();//企业类型
            configureCom.postDataAjax(configure.CONPANY_SIGN_REGISTER, formData).then(function (res) {
                if (res.code == 0) {
                    top.layer.alert('注册成功');
                    formData.orgNo = res.orgNo;
                    sessionFun.set(configure.SESSION_REGISTER_DATA, formData);
                    location.href = 'email.html';
                }
            });
            //获取附件信息
            /*window.frames["attachmentList"].window.getAttaList(function (result) {
                //判断必传
                if (typeItem == '2010') {//企业信息俩个必传
                    if (result.length < 2) {
                        configureCom.loadOff();
                        top.layer.msg('请上传附件');
                        return false;
                    }
                } else {//其他 一个必传
                    if (result.length < 1) {
                        configureCom.loadOff();
                        top.layer.msg('请上传附件');
                        return false;
                    }
                }
                data.dataAttachmentDTOList = [{
                    attachmentFileDTOList: result
                }];
                configureCom.postAjax(configure.ORGANIZATION_HTTP, JSON.stringify(data)).then(function (res) {
                    configureCom.loadOff();
                    if (res.code == 1) {
                        top.layer.msg('注册成功');
                        top.layer.close(window.popIndex);
                    } else {
                        top.layer.msg(res.msg);
                    }
                });
            });*/
            return false;
        });
    });

    function cancel() {
        window.location.href = "/login.html";
    }
</script>
</body>
</html>
